<?php

/**
 * informes actions.
 *
 * @package    sgcj
 * @subpackage informes
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 9301 2008-05-27 01:08:46Z dwhittle $
 */
class informesActions extends sfActions
{
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
  public function executeIndex()
  {
  }
  
  public function executeIndexinforme()
  {
  }
  
  public function executeInformeliquidacion()
  {
  }  
  
  public function executeReportecausa($request)
  {
  	$this->acreedor = AcreedorPeer::retrieveByPK($request->getParameter('idacreedor'));
  	
  	if($request->hasParameter('activa') || $request->hasParameter('terminada') || $request->hasParameter('castigada') || $request->hasParameter('incobrable') || $request->hasParameter('suspendida')){
  		
  		$filtroCausa = null;
  		$filtroCausa[0] = 0;
  		$filtroCausa[1] = 0;
  		$filtroCausa[2] = 0;
  		$filtroCausa[3] = 0;
  		$filtroCausa[4] = 0;
  		
  		if ($request->hasParameter('activa')){$filtroCausa[0] = 1;} 
  		if ($request->hasParameter('terminada')){$filtroCausa[1] = 1;}
  		if ($request->hasParameter('castigada')){$filtroCausa[2] = 1;}
  		if ($request->hasParameter('incobrable')){$filtroCausa[3] = 1;}
  		if ($request->hasParameter('suspendida')){$filtroCausa[4] = 1;}
  		
  		$this->estados = $filtroCausa;
  		
  		$this->causasList = CausaPeer::getCausasAcreedorFiltroDeEstado($this->acreedor, $filtroCausa);
  	
  	}else{
  		
  		$this->formFiltro = new FiltroEstadoCausaForm();
  		$this->formFiltro->setDefault('activa',true);
  		$this->setTemplate('filtroestadocausa');
  		
  	}
  }
   
  public function executeGenerareportecausa($request)
  {
  	$this->setLayout('reporte');

  	if($request->hasParameter('id_causa')){
  		
  		$this->causa = CausaPeer::retrieveByPK($request->getParameter('id_causa'));
  		$this->diligenciaList = DiligenciaPeer::getDilicenciasCausaPorFechaConLimite($this->causa,20);
  		
  	}else if($request->hasParameter('id_acreedor')){
  		
  		$filtroCausa = null;
  		
  		$filtroCausa[0] = 0;
  		$filtroCausa[1] = 0;
  		$filtroCausa[2] = 0;
  		$filtroCausa[3] = 0;
  		$filtroCausa[4] = 0;
  		
  		if ($request->hasParameter('activa')){$filtroCausa[0] = 1;} 
  		if ($request->hasParameter('terminada')){$filtroCausa[1] = 1;}
  		if ($request->hasParameter('castigada')){$filtroCausa[2] = 1;}
  		if ($request->hasParameter('incobrable')){$filtroCausa[3] = 1;}
  		if ($request->hasParameter('suspendida')){$filtroCausa[4] = 1;}
  		
  		$this->acreedor = AcreedorPeer::retrieveByPK($request->getParameter('id_acreedor'));
  		$this->causasList = CausaPeer::getCausasAcreedorFiltroDeEstado($this->acreedor,$filtroCausa);
  		$this->setTemplate('resumencausas');
  		
  	}
  }
  
  public function executeIndexcarta()
  {
  }

  public function executeRedactarcarta()
  {
  }
  
  public function executeShowcartaenviada()
  {
  }
  
  public function executeListformatocarta()
  {
  	$c = new Criteria();
  	$c->add(FormatoPeer::TIPO, '1');
  	$this->formatoList = FormatoPeer::doSelect($c);
  }
  
  public function executeShowformato($request)
  {
  	$this->formato = FormatoPeer::retrieveByPk($request->getParameter('id'));
    $this->forward404Unless($this->formato);
  }
  
  public function executeIndexescrito()
  {
  }
  
  public function executeRedactarescrito()
  {
  }
  
  public function executeShowescritoenviado()
  {
  }
  
  public function executeListformatoescrito()
  {
  	$c = new Criteria();
  	$c->add(FormatoPeer::TIPO, '0');
  	$this->formatoList = FormatoPeer::doSelect($c);
  }  
}
